{% import "components/nothing.html" as nothing with context %}
{% import "components/user.html" as user with context %}
{% import "components/paginator.html" as paginator with context %}
    {% if not ddocs %}
      {{ nothing.render('no discussion yet...') }}
    {% else %}
      <ol class="section__list discussion__list">
      {% for ddoc in ddocs %}
        <li class="section__list__item discussion__item{% if ddoc['highlight'] %} highlight{% endif %}">
          <div class="media">
            <div class="media__left">
              <div class="discussion__replies numbox">
                <div class="numbox__num large">{{ ddoc['num_replies'] }}</div>
                <div class="numbox__text">{{ _('Comments') }}</div>
              </div>
            </div>
            <div class="media__body top">
              <h1 class="discussion__title"><a href="{{ reverse_url('discussion_detail', did=ddoc['doc_id']) }}#{{ handler.datetime_stamp(ddoc['update_at']) if ddoc['update_at'] else '' }}" data-emoji-enabled>{{ ddoc['title'] }}</a></h1>
              <ul class="supplementary list">
                <li>
                  <a class="discussion-node-tag" href="{{ vj4.handler.discussion.node_url(handler, 'discussion_node', vj4.model.adaptor.discussion.node_id(ddoc)) }}">
                  {% if ddoc['parent_doc_type'] == vj4.model.document.TYPE_DISCUSSION_NODE %}
                    <span class="v-center icon icon-tag"></span>
                  {% elif ddoc['parent_doc_type'] == vj4.model.document.TYPE_CONTEST %}
                    <span class="v-center icon icon-award"></span>
                  {% else %}
                    <span class="v-center icon icon-flag"></span>
                  {% endif %}
                    {{ vndict[vj4.model.adaptor.discussion.node_id(ddoc)]['title']|default(_('(missing)')) }}
                  </a>
                </li>
                <li>
                  {{ user.render_inline(udict[ddoc['owner_uid']], dudoc=dudoc if dudoc else dudict[ddoc['owner_uid']], badge=false) }}
                  @
                  {{ datetime_span(ddoc['update_at'] or ddoc['_id'].generation_time) }}
                </li>
              </ul>
            </div>
          </div>
        </li>
      {% endfor %}
      </ol>
      {% if page != undefined and dpcount != undefined %}
      {{ paginator.render(page, dpcount) }}
      {% endif %}
    {% endif %}
